require "argot"

DictionaryLoader = { }
DictionaryLoader_mt = { __index = DictionaryLoader }

function DictionaryLoader.create(self)
	local attributes = {}
    setmetatable( attributes, DictionaryLoader_mt )
    return attributes
end


function DictionaryLoader.getDictionaryStream(name)
	if DictionaryLoader.instance == nil then
		DictionaryLoader.instance = DictionaryLoader:create()
	end
	
	return DictionaryLoader.instance:getStream(name)
end


function DictionaryLoader.getStream(self, name)
    local f = io.open(name, 'rb')
    if f ~= nil then
	    print('Opened ' .. name)
	else
        print('Could not open ' .. name)
        return
    end


    function read(size)
        local res = f:read(size)
        return res
    end
    
    return read
end

